<div bsModal #createOrEditModal="bs-modal" [config]="{backdrop: 'static'}" (onShown)="onShown()" aria-labelledby="createOrEditModal" class="modal fade" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <form *ngIf="active" #peripheralForm="ngForm" name="PeripheralForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="peripheral?.id">{{l("EditNewPerip")}}: {{peripheral?.name}}</span>
                        <span *ngIf="!peripheral.id">{{l("CreateNewPerip")}}</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <i aria-hidden="true" class="ki ki-close"></i>
                    </button>
                </div>
                <div class="modal-body">
                    <tabset class="tab-container tabbable-line">
                        <tab heading="{{l('PeripheralMsg')}}" customClass="kt-tabs__item">
                            <div class="row">
                                <div class="col-12">
                                    <div class="form-group">
                                        <label>{{l("PeriName")}} *</label>
                                        <input #nameInput="ngModel" class="form-control" type="text" name="Name" [(ngModel)]="peripheral.name" required maxlength="32">
                                        <validation-messages [formCtrl]="nameInput"></validation-messages>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label">{{l("Picture")}} *</label>
                                        <app-fileupload
                                         [fileUrl]="peripheral.iconUrl"
                                         (onUpLoadEvent)="onUpload($event)"
                                         (onBeforeSendEvent)="onBeforeSend($event)"
                                        ></app-fileupload>
                                    </div>
                                </div>
                            </div>
                        </tab>
                    </tabset>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-primary" (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!peripheralForm.form.valid" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{l("Save")}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>
